package com.qfedu.knowledge.controller;

import com.qfedu.knowledge.entity.dto.BasePageDTO;
import com.qfedu.knowledge.entity.dto.BatchWrongDTO;
import com.qfedu.knowledge.entity.dto.WrongDTO;
import com.qfedu.knowledge.entity.vo.ResultVO;
import com.qfedu.knowledge.service.IQuestionWrongService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName QuestionWrongController
 * @Author ykx
 * @Date 2024/4/29 18:31
 * @Version 1.0
 */
@RestController
@RequestMapping("/knowledge")
public class QuestionWrongController {

    @Autowired
    private IQuestionWrongService questionWrongService;

    @PostMapping("/wrong/save")
    public ResultVO save(@RequestBody WrongDTO wrongDTO) {
        return ResultVO.success(questionWrongService.insert(wrongDTO));
    }

    @PostMapping("/wrong/batchSave")
    public ResultVO batchSave(@RequestBody BatchWrongDTO batchWrongDTO) {
        return ResultVO.success(questionWrongService.batchInsert(batchWrongDTO));
    }

    @GetMapping("/wrong/list")
    public ResultVO list(BasePageDTO basePageDTO) {
        return ResultVO.success(questionWrongService.getWrongList(basePageDTO));
    }

    @DeleteMapping("/wrong/correct/{id}")
    public ResultVO correct(@PathVariable Integer id) {
        return ResultVO.success(questionWrongService.removeById(id));
    }
}
